import React, { useEffect, useState } from 'react'
import { Carousel } from 'antd';
import { request } from 'umi';
const contentStyle: React.CSSProperties = {
    height: '160px',
    color: '#fff',
    lineHeight: '160px',
    textAlign: 'center',
    background: '#364d79',
};
export default function Banner() {
    let [data, setData] = useState([])
    useEffect(() => {
        async function banners() {
            let data = await request("/api/users")
            setData(data)
        }
        banners()
    }, [])
    return (
        <div>
            <Carousel effect="fade" autoplay={true}>
                {data.length && data.map((ele: any) => (
                    <div style={contentStyle} key={ele.id}>
                        <img style={{
                            width: '100%',
                            height: "100%"
                        }} src={ele.src} alt="图片" />
                    </div>
                ))}
            </Carousel>
        </div>
    )
}
